﻿package com.tangchao.client.entities{
	import com.smartfoxserver.v2.entities.SFSUser;
	import com.smartfoxserver.v2.entities.User;
	import com.tangchao.client.*;
	
	import de.polygonal.ds.HashMap;

	public class User{
		private var rawUser:SFSUser;
		private var role:String;
		private var seatNo:int;
		private var status:String;
		private var level:int;
		private var experience:int;
		private var gender:int;
		private var headPic:String;
		private var credit:int;
		private var vigour:int;
		private var balance:Number;
		private var buddyMode:Boolean;
		private var honors:HashMap;

		public function User(user:SFSUser, name:String = null){
			rawUser = (null == user ? new SFSUser(Constants.USER_ID_FAKE, name, false) : user);
			honors = new HashMap();
		}

		public function getRawUser(): SFSUser {
			return rawUser;
		}
		public function getId():int{
			return rawUser.id;
		}

		public function getName():String{
			return rawUser.name;
		}

		public function getStringVariable(key:String):String{
			return rawUser.getVariable(key).getStringValue();
		}

		public function getIntVariable(key:String):int{
			return rawUser.getVariable(key).getIntValue();
		}

		public function setRole(value:String):void{
			role = value;
		}

		public function getRole():String{
			return role;
		}

		public function setSeatNo(value:int):void{
			seatNo = value;
		}

		public function getSeatNo():int{
			return seatNo;
		}

		public function setStatus(value:String):void{
			status = value;
		}

		public function getStatus():String{
			return status;
		}

		public function setLevel(value:int):void{
			level = value;
		}

		public function getLevel():int{
			return level;
		}

		public function setExperience(value:int):void{
			experience = value;
		}

		public function getExperience():int{
			return experience;
		}

		public function setGender(value:int):void{
			gender = value;
		}

		public function getGender():int{
			return gender;
		}

		public function setHeadPic(value:String):void{
			headPic = value;
		}

		public function getHeadPic():String{
			return headPic;
		}

		public function setCredit(value:int):void{
			credit = value;
		}

		public function getCredit():int{
			return credit;
		}
		
		public function getVigour():int {
			return vigour;
		}
		
		public function setVigour(value:int):void {
			vigour = value;
		}
		
		public function getBalance():Number {
			return balance;
		}
		
		public function setBalance(balance:Number):void {
			this.balance = balance;
		}
		
		public function setBuddyMode(buddyMode:Boolean):void {
			this.buddyMode = buddyMode;
		}
		
		public function getBuddyMode():Boolean {
			return buddyMode;
		}
		
		public function getHonor(type:String):Honor {
			return Honor(honors.get(type));
		}
		
		public function setHonor(type:String, honor:Honor):void {
			honors.set(type, honor);
		}
	}
}

